package com.xnfh.field.viewmodel

import com.xnfh.common.bean.FieldDetailBean
import com.xnfh.framework.base.BaseViewModel
import com.xnfh.framework.bean.RespStateData
import org.json.JSONObject

/**
 * @Description:
 * @Author: ziheng
 * @CreateDate: 2023/12/7 11:41
 * @UpdateUser: ziheng
 * @UpdateDate: 2023/12/7 11:41
 * @UpdateRemark: 更新说明
 */
class FieldTendencyImageViewModel: BaseViewModel() {

    private val fieldTendencyImageViewModelRes = FieldTendencyImageViewModelRes()
    val fieldDetailData = RespStateData<FieldDetailBean>()


    /**
     * 通过地块ID和年份请求数据
     */
    fun requestFieldDetailByYear(fieldId: Long?,year: String?) = launch {
        val jsonObject = JSONObject()
        jsonObject.put("fieldId",fieldId)
        jsonObject.put("year",year)
        fieldTendencyImageViewModelRes.requestFieldDetailByYear(creatRequestBody(jsonObject.toString()),fieldDetailData)
    }

}